package com.zrrd.objectStream;

import java.io.Serializable;

/**
 * @author WanJl
 * @version 1.0
 * @title Student
 * @description 一个对象能够被序列化的前提，是他的类型必须是实现了Serializable接口
 * @create 2024/5/26
 */
public class Student implements Serializable {
    //序列化时用的ID
    private static final long serialVersionUID = 1L;


    private String name;
    //age不想序列化，就可以使用transient关键字进行修饰
    private transient int age;

    public Student() {
    }
    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }
    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
